﻿
using System;
using System.Collections.Generic;
using System.Text;

using YouHP.Utility;
using YouHP.BLL;
using YouHP.Model;
using System.Web;
using YouHP.Model.Group;

namespace YouHP.Pages.SymptomHistory
{
    public class SymptomSelect:BasePage
    {

        protected override void ShowPage()
        {
            base.ShowPage();
            if (ErrorCount > 0) return;

            HandleCommon();
            if (ErrorCount > 0) return;

            if (IsPost) HandlePost();
            else HandleGet();
        }


        protected List<SymptomInfo> SymptomDataList;
        protected List<DiseaseInfo> DiseaseLst;
        protected int SymptomCount = 0;
        protected int SymptomPageCount = 0;
        protected int SymptomPageSize = 15;
        protected int SymptomPageIndex = 1;
        protected string SymptomPagingString;

        protected void HandleCommon()
        {
            this.AddLocation("症状记录", "/SymptomHistory/Index.aspx");
            this.AddLocation("选择症状", "/SymptomHistory/SymptomSelect.aspx");
            DiseaseLst = DiseaseBLL.Instance.GetAllDiseaseByName("");
        }

        protected void HandlePost()
        {

        }

        protected void HandleGet()
        {


            SymptomSearchConditon cond = new SymptomSearchConditon();
            cond.DiseaseId = RequestTools.GetInt("dszid", 0);
            cond.DiseaseName = RequestTools.GetString("dszname");
            cond.SymptomName = RequestTools.GetString("symname");

            SymptomPageIndex = RequestTools.GetQueryInt("page", 1);

            SymptomDataList = SymptomBLL.Instance.GetSymptomList(
                SymptomPageSize, SymptomPageIndex,
                cond, out SymptomCount);

            SymptomPageCount = Utils.GetPageCount(SymptomCount, SymptomPageSize);

            string query = HttpContext.Current.Request.Url.Query;
            query = Utils.RemoveQueryItem(query, "page");

            SymptomPagingString = this.GetPagingString(
                SymptomPageIndex,
                SymptomPageCount,
                "/SymptomAll.aspx" + query, "page");
        }

    }
}